]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
cleanup: Prefer CoglColor.init_form_4f
authorBilal Elmoussaoui <belmouss@redhat.com>
Mon, 29 Jan 2024 13:27:07 +0000 (14:27 +0100)
committerBilal Elmoussaoui <belmouss@redhat.com>
Fri, 16 Feb 2024 11:34:30 +0000 (12:34 +0100)
As we are slowly moving colors to be represented by a [0, 1] floats.
The unsigned integer variant will likely be removed in the near future, so be
ready for that already

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3147>

src/st/st-private.c
src/st/st-theme-node-drawing.c

index f7ea118a526de52148ba5e85f91945179def290f..e310bdb70efe50c619e6e0b63ead96767cff8ef1 100644 (file)
@@ -558,7 +558,7 @@ _st_create_shadow_pipeline_from_actor (StShadow     *shadow_spec,
           return NULL;
         }
 
-      cogl_color_init_from_4ub (&clear_color, 0, 0, 0, 0);
+      cogl_color_init_from_4f (&clear_color, 0.0, 0.0, 0.0, 0.0);
       clutter_actor_get_position (actor, &x, &y);
       x *= resource_scale;
       y *= resource_scale;
@@ -787,11 +787,11 @@ _st_paint_shadow_with_opacity (StShadow        *shadow_spec,
 
   st_shadow_get_box (shadow_spec, box, &shadow_box);
 
-  cogl_color_init_from_4ub (&color,
-                            shadow_spec->color.red   * paint_opacity / 255,
-                            shadow_spec->color.green * paint_opacity / 255,
-                            shadow_spec->color.blue  * paint_opacity / 255,
-                            shadow_spec->color.alpha * paint_opacity / 255);
+  cogl_color_init_from_4f (&color,
+                           shadow_spec->color.red / 255.0   * paint_opacity / 255.0,
+                           shadow_spec->color.green / 255.0 * paint_opacity / 255.0,
+                           shadow_spec->color.blue / 255.0  * paint_opacity / 255.0,
+                           shadow_spec->color.alpha / 255.0 * paint_opacity / 255.0);
   cogl_color_premultiply (&color);
   cogl_pipeline_set_layer_combine_constant (shadow_pipeline, 0, &color);
   cogl_framebuffer_draw_rectangle (framebuffer,
index f6039194583bf05aa5a443fae3397de20f1a0077..081ccbef55040557fb63ecf407e89806fce99648 100644 (file)
@@ -2120,11 +2120,11 @@ st_theme_node_paint_sliced_shadow (StThemeNodePaintState *state,
   right += xoffset;
 
   /* Setup pipeline */
-  cogl_color_init_from_4ub (&color,
-                            box_shadow_spec->color.red   * paint_opacity / 255,
-                            box_shadow_spec->color.green * paint_opacity / 255,
-                            box_shadow_spec->color.blue  * paint_opacity / 255,
-                            box_shadow_spec->color.alpha * paint_opacity / 255);
+  cogl_color_init_from_4f (&color,
+                           box_shadow_spec->color.red / 255.0   * paint_opacity / 255.0,
+                           box_shadow_spec->color.green / 255.0 * paint_opacity / 255.0,
+                           box_shadow_spec->color.blue / 255.0 * paint_opacity / 255.0,
+                           box_shadow_spec->color.alpha / 255.0 * paint_opacity / 255.0);
   cogl_color_premultiply (&color);
 
   cogl_pipeline_set_layer_combine_constant (state->box_shadow_pipeline, 0, &color);